package com.mingqi.enetconnected.primary.mytask.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.mingqi.enetconnected.R;
import com.mingqi.enetconnected.base.BaseActivity;
import com.mingqi.enetconnected.data.bean.order.GoodsOrder;
import com.mingqi.enetconnected.primary.mytask.adapter.SearchListAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class SelectGoodsActivity extends BaseActivity implements TextWatcher, View.OnClickListener {


    @BindView(R.id.et_select_content)
    EditText mEtSelectContent;
    @BindView(R.id.tv_select)
    TextView mTvSelect;
    @BindView(R.id.recycler_search_list)
    RecyclerView mSearchListRecycler;
    private SearchListAdapter mSearchListAdapter;

    @Override
    protected int getLayoutID() {
        return R.layout.activity_select_goods;
    }

    @Override
    protected void initView() {

        mTVTitle.setText(getResources().getString(R.string.please_select_goods));

        mSearchListAdapter = new SearchListAdapter(null);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        mSearchListRecycler.setLayoutManager(layoutManager);
        mSearchListRecycler.setAdapter(mSearchListAdapter);


        mEtSelectContent.addTextChangedListener(this);
        mTvSelect.setOnClickListener(this);
    }

    @Override
    protected void initData() {
        super.initData();

    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {

    }

    @Override
    public void onClick(View v) {
        List<GoodsOrder> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            GoodsOrder goodsOrder = new GoodsOrder();
            list.add(goodsOrder);
        }
        mSearchListAdapter.setNewData(list);
    }
}
